from rest_framework import serializers
from cake import models

class CakeSerializer(serializers.ModelSerializer):
    class Meta:
        model=models.CakeModel
        fields='__all__'

class CakeDemilSer(serializers.ModelSerializer):
    cakelist=serializers.SerializerMethodField(read_only=True)
    def get_cakelist(self,obj):
        return {"title":obj.cake.title,"weight":obj.cake.weight,"price":obj.cake.price,"tro":obj.cake.tro}
    class Meta:
        model=models.CakeDemil
        fields="__all__"

class BannerSerializer(serializers.ModelSerializer):
    class Meta:
        model=models.BannerModel
        fields='__all__'

class CateSer(serializers.ModelSerializer):
    class Meta:
        model=models.CateModel
        fields='__all__'

class Category(serializers.ModelSerializer):
    class Meta:
        model=models.CategoryModel
        fields='__all__'